<template>
  <view class="content">
    <!--   没有商品时的状态 上半部分-->
    <view v-show="isDisplay">
      <view class="shop-empty">
        <image style="width: 150px;height: 150px" src="/static/image/shop_empty.png"></image>
        <text class="shop-empty-text">
          购物车空空，快去挑选服务吧~
        </text>
        <view class="shop-empty-select-container">
          <u-button class="shop-empty-select-container-button" :plain="true" color="#2f80ff" shape="circle"
                    text="逛逛首页" @click="toIndex"></u-button>
          <u-button class="shop-empty-select-container-button" shape="circle" type="primary "
                    text="查看全部服务" @click="toAllServe"></u-button>
        </view>
      </view>
      <!--    标签页-->
      <tabs class="tabs-margin"></tabs>
    </view>
    <!-- 有商品的状态-->
    <view class="tabs-content" v-show="!isDisplay">
      <u-checkbox-group
          v-model="checkboxValue1"
          placement="column"
          @change="checkboxChange">
        <uni-card margin="8px" spacing="0" v-for="index in 6" :key="index">
          <view class="tabs-content-card">
            <u-checkbox shape="circle" size="25" icon-size="20" :key="index">
            </u-checkbox>
            <image src="https://cx-img-oss.zmn.cn/cx-zmn/user/img/20240103/1704276590862.jpg"
                   mode="scaleToFill"></image>
            <view class="tabs-content-card-info">
              <view class="tabs-content-card-info-text">
                <text class="tabs-content-card-info-text-title">洗衣机维修</text>
              </view>
              <view class="tabs-content-card-info-bottom">
                <view class="tabs-content-card-info-bottom-price">
                  ￥
                  <text class="tabs-content-card-info-bottom-price-number">88</text>
                  元/台起
                </view>
                <view class="tabs-content-card-info-bottom-calc">
                  <u-number-box button-size="25" integer :min="1" :max="100" v-model="value"
                                @change="valChange"></u-number-box>
                </view>
              </view>
            </view>
          </view>
        </uni-card>
        <view class="placeholder"></view>
        <!--      固定在底部-->
        <u-checkbox-group
            v-model="checkboxValueSelectAll"
            placement="column"
            @change="checkboxChangeSelectAll">
          <view class="fixation">
            <u-checkbox
                shape="circle" size="25" icon-size="20"
                label="全选"
                name="全选">
            </u-checkbox>
            <view class="fixation-container">
              <view class="fixation-container-sum">
                <view class="fixation-container-sum-text">合计：
                </view>
                <text class="fixation-container-sum-price">￥833.00</text>
              </view>
              <view class="fixation-container-button">
                <u-button type="primary" shape="circle" text="去下单"></u-button>
              </view>
            </view>
          </view>
        </u-checkbox-group>
      </u-checkbox-group>
    </view>
  </view>
</template>

<script>
import tabs from './tabs/tabs.vue'

export default {
  components: {
    tabs
  },
  data() {
    return {
      isDisplay: false,
      value: 1,
      checkboxValue1: [],
      checkboxValueSelectAll: [],
      // 基本案列数据
      checkboxList1: [
        {
          name: '苹果',
          disabled: false
        }
      ],
    }
  },
  methods: {
    toAllServe(){
      uni.switchTab({
        url: '/pages/tabs/all-servers/all-servers'
      })
    },
    toIndex(){
      uni.switchTab({
        url: '/pages/tabs/index/index'
      })
    },
    // 获取商品数量改变
    valChange(e) {
      console.log(e.value)
    },
    // 获取商品的多选
    checkboxChange(n) {
      console.log('change', n);
    },
    // 全选按钮
    checkboxChangeSelectAll() {

    }
  }
}
</script>

<style lang="scss" scoped>
page {
  background: #f3f3f5;
}

.shop-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  &-text {
    font-size: 14px;
  }

  &-select-container {
    margin-top: 10px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-content: center;

    &-button {
      flex: 1;
      margin: 0 10px;
      padding: 0 25px;
    }
  }
}

// 商品card
.tabs-content {
  margin-top: 15px;
  position: relative;

  &-card image {
    width: 190rpx;
    height: 190rpx;
    border-radius: $uni-border-radius;
  }

  &-card {
    display: flex;

    &-info {
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      align-items: flex-start;
      margin-left: 10px;
      width: 56%;

      &-text {
        display: flex;
        flex-direction: column;

        &-title {
          font-size: 16px;
          font-weight: 700;
          color: black;
        }
      }

      &-bottom {
        width: 100%;
        display: flex;
        flex-direction: row;
        justify-content: space-between;
        align-items: center;

        &-price {
          color: red;

          &-number {
            font-size: 20px;
            font-weight: 500;
          }

        }
      }
    }
  }
}

// 底部固定栏
.fixation {
  position: fixed;
  /* #ifdef MP-WEIXIN */
  bottom: 0;
  /* #endif */
  /* #ifndef MP-WEIXIN */
  bottom: 50px;
  /* #endif */
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  width: 95%;
  align-items: center;
  padding: 10px 0;
  background-color: #FFFFFF;
  z-index: 99;

  &-container {
    display: flex;

    &-sum {
      width: 100%;
      display: flex;
      flex-direction: row;
      align-items: center;
      margin-right: 10px;

      &-price {
        color: red;
      }
    }
  }
}

.tabs-margin {
  margin-top: 30px;
}

.placeholder {
  width: 100%;
  height: 110px;
}
</style>
